package com.tadpole.music.model.base;

import com.tadpole.music.callback.BaseCallback;
import com.tadpole.music.utils.HttpUtil;
import com.zhy.http.okhttp.callback.StringCallback;

import java.util.HashMap;

import okhttp3.Call;
import okhttp3.FormBody;
import okhttp3.Request;

/**
 * Created By 孙岩
 * on 2020/9/17
 */
public class PutModel extends BaseModel<String>{
    @Override
    public void execute(final BaseCallback<String> callback) {

        FormBody build = new FormBody.Builder()
                .add(mParamsKey[0], mParamsValue[0])
                .build();
        HttpUtil.requestPutHead(url, token, build, new StringCallback() {
            @Override
            public void onError(Call call, Exception e, int id) {
                callback.onFailure(e.toString());
            }

            @Override
            public void onResponse(String response, int id) {
                callback.onSuccess(response);
            }

            @Override
            public void onBefore(Request request, int id) {
                callback.onBefore();
            }

            @Override
            public void onAfter(int id) {
                callback.onComplete();
            }
        },"1");
    }
}
